package ru.reinvent.perspectiva.activities;

import android.content.Context;
import android.os.Bundle;
import android.view.inputmethod.InputMethodManager;

import com.actionbarsherlock.app.SherlockFragmentActivity;
import com.actionbarsherlock.view.MenuItem;

import ru.reinvent.perspectiva.fragments.OfferFragment;

public class OfferActivity extends SherlockFragmentActivity
	{
	public void onCreate(Bundle savedInstance) 
		{
		super.onCreate(savedInstance);
		getSupportActionBar().setHomeButtonEnabled(true);
		getSupportActionBar().setDisplayHomeAsUpEnabled(true);

		getSupportFragmentManager().beginTransaction().add(android.R.id.content,new OfferFragment()).commit();
		}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) 
		{
		if (item.getItemId() == android.R.id.home)
			{
			final InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
			final boolean hidden = imm.hideSoftInputFromWindow(findViewById(android.R.id.content).getWindowToken(),InputMethodManager.HIDE_NOT_ALWAYS);
			if (!hidden) finish();
			}
			
		return super.onOptionsItemSelected(item);
    	} 

	}
